package com.cloud.pole.rpc;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.cloud.pole.api.param.PicklistApi;
import com.cloud.pole.api.user.BaseUserApi;
import com.cloud.pole.common.constant.CommonConstants;
import com.cloud.pole.common.exception.BaseException;
import com.cloud.pole.common.exception.ParamException;
import com.cloud.pole.common.msg.ApiRestResponse;
import com.cloud.pole.common.util.RegexUtils;
import com.cloud.pole.pay.service.PayCcbService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("api/payCcb")
public class PayCcbRest {
	
	@Autowired
	private PayCcbService payCcbService;

	/**
	 * 生成建行支付参数
	 * @param payId
	 * @param orderId
	 * @param amount
	 * @return
	 */
    @RequestMapping(value = "/threeStarPayInApp", method = RequestMethod.GET)
    public ApiRestResponse<String> threeStarPayInApp(Integer payId, String payNo, Long amount){   	
    	try {
    		Map<String, Object> map = payCcbService.threeStarPayInApp(payId, payNo, amount);
			return ApiRestResponse.success(CommonConstants.STATUS_OK_MESSAGE, JSON.toJSONString(map));
		} catch (BaseException e) {
			return ApiRestResponse.fail(e.getStatus(), e.getMessage(), null);
		} catch (Exception e) {
			log.error(CommonConstants.STATUS_ERROR_MESSAGE + "{}", e.getMessage(), e);
			return ApiRestResponse.fail(CommonConstants.STATUS_ERROR_MESSAGE, null);
		}
    }
}
